import { get, post } from '../request'

const address = {

  // 获取指定收货地址
  getAddress(addressId) {
    return get(
      `/address/${addressId}`,
    )
  },

  // 获取用户默认收货地址
  getDefaultAddressOfUser() {
    return get(
      '/address/default'
    )
  },

  // 获取用户所有收货地址
  getAddressOfUser() {
    return get(
      `/address/user`,
    )
  },

  // 设置用户默认收货地址
  setDefaultAddress(param) {
    return post(
      '/address/set-default',
      param,
    )
  },

  // 修改收货地址
  modifyAddress(param) {
    return post(
      '/address/modify',
      param,
    )
  },

  // 新增一个收货地址
  addNewAddress(param) {
    return post(
      '/address/add',
      param,
    )
  },

  // 删除一个收货地址
  deleteAddress(addressId) {
    return post(
      `/address/delete/${addressId}`
    )
  }
}

export default address;